<ui:fragment xmlns="http://www.w3.org/1999/xhtml"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:p="http://primefaces.org/ui"
             xmlns:f="http://java.sun.com/jsf/core"
             xmlns:c="http://java.sun.com/jsp/jstl/core"
             xmlns:ui="http://java.sun.com/jsf/facelets">
    <div class="btn-group">
        <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
            #{value}
            <span class="caret"></span>
        </a>
        <ul class="dropdown-menu">
            <ui:repeat value="#{items}"
                       var="item">
                <li class="#{(item eq value) ? 'active' : ''}">
                    <a href="#" onclick="change#{id}_#{item}();">#{item}</a>
                </li>

                <p:remoteCommand id="cmdOncomplete#{id}_#{item}"
                                 name="oncomplete#{id}_#{item}"
                                 global="false"
                                 actionListener="#{actionListener}"
                                 update="#{update}"/>

                <p:remoteCommand id="cmdChange#{id}_#{item}"
                                 name="change#{id}_#{item}"
                                 global="false"
                                 oncomplete="oncomplete#{id}_#{item}">
                    <f:setPropertyActionListener target="#{value}" value="#{item}"/>
                </p:remoteCommand>
            </ui:repeat>
        </ul>
    </div>
</ui:fragment>